<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                xmlns:fbi="http://www.fbifaces.org"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                }
            }
        </script>
        <style type="text/css">
            .col-1 {
                width: 87%;
            }

            .col-2 {
                width: 13%;
            }
        </style>
    </ui:define>
    <ui:define name="content">
        <div style="margin:5px">
            <p:tabView id="tabview" dynamic="true" cache="false" style="font-weight:normal;font-style:normal">
                <p:tab title="新卡号生成">
                    <h:form id="form">
                        <p:messages id="msgs" showDetail="false"/>
                        <p:panel style="margin-top:10px" id="panel">
                            <h:panelGrid columns="4" cellspacing="5" style="text-align: right;">
                                <h:outputLabel value="起始卡序号(7位):"/>
                                <p:inputText value="#{cardChkCodeAction.cardSeqNo}" required="true"
                                             requiredMessage="必须输入卡序号！" size="27" maxlength="7"/>
                                <h:outputLabel value="卡种:"/>
                                <h:selectOneMenu value="#{cardChkCodeAction.cardType}" style="width: 187px;">
                                    <f:selectItems value="#{cardChkCodeAction.cardTypeOptions}"/>
                                </h:selectOneMenu>
                                <h:outputLabel value="制卡数量:"/>
                                <p:inputText value="#{cardChkCodeAction.cardCnt}"
                                             required="true" requiredMessage="必须输入制卡数量！" size="27" maxlength="7">
                                    <f:convertNumber integerOnly="true"/>
                                </p:inputText>
                                <h:outputLabel/>
                                <h:panelGroup>
                                    <p:commandButton id="makBtn" value="确认生成" style="width:90px;align:right;"
                                                     action="#{cardChkCodeAction.makeCardNo}"
                                                     update="form,msgs,pdt"/>
                                    <p:commandButton id="downloadBtn" ajax="false" value="EXCEL导出" style="width:100px;">
                                        <fbi:DataExporter target="pdt" type="xls" titleName="新生成卡号"
                                                          fileName="#{cardChkCodeAction.fileName}"
                                                          excludeColumnsWidth="30"/>
                                    </p:commandButton>
                                </h:panelGroup>
                            </h:panelGrid>
                        </p:panel>
                        <p:ajaxStatus style="height:18px;text-align:center">
                            <f:facet name="start">
                                <h:graphicImage value="/images/ajaxloadingbar.gif"/>
                            </f:facet>
                            <f:facet name="complete">
                                <h:outputText value=""/>
                            </f:facet>
                        </p:ajaxStatus>
                        <p:dataTable id="pdt" dynamic="true" style="width:100%;"
                                     value="#{cardChkCodeAction.cardNoList}" var="record"
                                     paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                     paginator="true" rows="15" paginatorPosition="bottom"
                                     rowsPerPageTemplate="100,50,30,15,5"
                                     emptyMessage="没有查询到数据记录...">
                            <p:column headerText="卡号" style="text-align: center">
                                <h:outputText value="#{record}"/>
                            </p:column>
                        </p:dataTable>
                    </h:form>
                </p:tab>
            </p:tabView>
        </div>
    </ui:define>
</ui:composition>